import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class ToastDemoPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('第三方框架Toast测试页面'),
        backgroundColor: Colors.blue,
      ),    //将参数当作页面标题

      body: new Column(

        children: <Widget>[

          new Padding(
            padding: new EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
            child: new Row(
              children: <Widget>[
                new Expanded(

                  child: new RaisedButton(
                    onPressed: (){

                      Fluttertoast.showToast(
                          msg: "This is Center Short Toast",
                          toastLength: Toast.LENGTH_SHORT,
                          gravity: ToastGravity.CENTER,
                          timeInSecForIos: 1,
                          backgroundColor: Colors.red,
                          textColor: Colors.white
                      );

                    },
                    //通过控制 Text 的边距来控制控件的高度
                    child: new Padding(

                      padding: new EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 10.0),
                      child: new Text('弹出Toast'),

                    ),
                    color: Colors.lightBlue,
                  ),
                ),
              ],
            ),
          ),

        ],

      )
    );
  }
}